package com.fare.taluo.vo.core.fdc;

import java.text.DecimalFormat;
import java.util.Locale;

import org.apache.commons.lang.StringUtils;

import com.fare.taluo.util.I18nUtil;


/**
 * 首页右边航向最低价，座公里数，客座率 VO
 * @author spring.华 
 */
public class IndexPriceVo {
	
	private String hightOrLower;
	
	private String myPrice;
	private String myFlightNO;
	
	private String marketPrice;
	private String marketFlightNo;
	
	/**
	 * 航向最低价，座公里数，客座率 VO
	 */
	private String typeName;
	
	/**
	 * 如果Type=1 表示是座公里收入  Type=2表示是：客座率 
	 */
	private Integer type=0;
	
	/**我比市场高*/
	private String result;
	
	private String action;
	/** 是否有数据优于收益首页第二个报表*/
	private String isHeadDate;
	
	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public String getHightOrLower() {
		return hightOrLower;
	}

	public void setHightOrLower(String myprice,String makerPrice,Locale locale) {
		if(StringUtils.isNotEmpty(myprice)&&!"null".equals(myprice)){
			this.myPrice=myprice;
		}
		if(StringUtils.isNotEmpty(makerPrice)&&!"null".equals(makerPrice)){
			this.marketPrice=makerPrice;
		}
		if(StringUtils.isNotEmpty(myprice)&&!makerPrice.equals("0")&&
				!makerPrice.equals("0.0") &&StringUtils.isNotEmpty(makerPrice)&&!"null".equals(myprice)&&!"null".equals(makerPrice)){
			String s=(Double.parseDouble(myprice)/Double.parseDouble(makerPrice))-1+"";
			if(StringUtils.isNotEmpty(s)&&s.length()>7){
				s=s.substring(0,7);
				
				DecimalFormat decfmt = new DecimalFormat("##0.00");
				
				Float d=Float.parseFloat(decfmt.format(Float.parseFloat(s)*100)+"");
				this.result=d+"";
			}else if(StringUtils.isNotEmpty(s)){
				DecimalFormat decfmt = new DecimalFormat("##0.00");
				Float d=Float.parseFloat(decfmt.format(Float.parseFloat(s)*100)+"");
				this.result=d+"";
			}
			if(StringUtils.isNotEmpty(result)&&Float.parseFloat(this.result)>0){//
//				this.hightOrLower= I18nUtil.getProperties(locale).get("income.higher");
				this.hightOrLower="H";
			}else{
//				this.hightOrLower=I18nUtil.getProperties(locale).get("income.lower");
				this.hightOrLower="D";
			}
		}else{//无法比较	
			
		}
		
	}

	public String getMyPrice() {
		if(StringUtils.isEmpty(myPrice)){
			return myPrice;
		}
		DecimalFormat decfmt = new DecimalFormat("##0.000");
		if(type==1){///如果Type=1 表示是座公里收入  Type=2表示是：客座率 
			myPrice=Float.parseFloat(decfmt.format(Float.parseFloat(myPrice)/1000))+"";
		}else if(type==2){
			myPrice=Float.parseFloat(decfmt.format(Float.parseFloat(myPrice)/100))+"";
		}
		return myPrice;
	}

	public void setMyPrice(String myPrice) {
		this.myPrice = myPrice;
	}

	public String getIsHeadDate() {
		return isHeadDate;
	}

	public void setIsHeadDate(String isHeadDate) {
		this.isHeadDate = isHeadDate;
	}

	public String getMyFlightNO() {
		return myFlightNO;
	}

	public void setMyFlightNO(String myFlightNO) {
		this.myFlightNO = myFlightNO;
	}

	public String getMarketPrice() {
		if(StringUtils.isEmpty(marketPrice)){
			return marketPrice;
		}
		DecimalFormat decfmt = new DecimalFormat("##0.000");
		if(type==1){///如果Type=1 表示是座公里收入  Type=2表示是：客座率 
			marketPrice=Float.parseFloat(decfmt.format(Float.parseFloat(marketPrice)/1000))+"";
		}else if(type==2){
			marketPrice=Float.parseFloat(decfmt.format(Float.parseFloat(marketPrice)/100))+"";
		}
		return marketPrice;
	}

	public void setMarketPrice(String marketPrice) {
		this.marketPrice = marketPrice;
	}

	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	public String getMarketFlightNo() {
		return marketFlightNo;
	}

	public void setMarketFlightNo(String marketFlightNo) {
		this.marketFlightNo = marketFlightNo;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}


	
}
	
